package com.wyp168.jvm001;

/**
 * @ClassName TwoThradDoOneClassStaticTest001
 * @Description TODO
 * @Author wyp168
 * @Date 2022/7/19 15:56
 */
public class TwoThreadDoOneClassStaticTest001 {
    public static void main(String[] args) throws InterruptedException {
        Runnable r = () -> {
            System.out.println(Thread.currentThread().getName() + "开始");
            DeadThread deadThread = new DeadThread();
            System.out.println(Thread.currentThread().getName() + "结束");
        };

        Thread threadA = new Thread(r);
        Thread threadB = new Thread(r);

        threadA.start();
        threadB.start();

        threadA.join();
        threadB.join();

        System.out.println("All of Thread has run.");
    }

    static class DeadThread {
        static {
            if (true) {
                System.out.println(Thread.currentThread().getName() + " 正在初始化 DeadThread 类");
                while (true) {

                }
            }
        }
    }
}
